<template>
	<view>
		<!-- <image src="../../static/img/bg1.jpg" mode="aspectFill"></image>		 -->
		<view class="box"></view>
		<view class="iconfont icon-icon-test3"></view>
		<view class="iconfont icon-bingqilin"></view>
		<view class="iconfont icon-bangbangtang"></view>
		<view>{{msg}}</view>
		<view>{{age>18?"成年了":"未满18周岁"}}</view>
		<view>
			<image v-bind:src="imgUrl"></image>
		</view>
		<view v-for="(item,index) in arr">{{index}}{{item.name}}</view>
		<view>
			<button type="primary" @click="doit(1,$event)">点我</button>
		</view>
		<view>
			<button type="warn" @click="send(1,5)">发送请求</button>
		</view>
		<view>
			<button type="primary" @click="sendImg()">图片上传</button>
		</view>
		<view>
			<image v-for="item in imgarr" :src="item" @click="previewImg(item)"></image>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				msg:"uniapp_text",
				age:25,
				imgUrl:"../../static/img/bg1.jpg",
				imgarr:[],
				arr: [
				      { name: '刘能', age: 29 },
				      { name: '赵四', age: 39 },
				      { name: '宋小宝', age: 49 },
				      { name: '小沈阳', age: 59 }
				    ]
			}
		},
		onLoad() {

		},
		methods: {
			doit(num,e){
				console.log(num)
				console.log(e)
				console.log("真的点我了")
			},
			send(){
				uni.request({
					url:"http://localhost:8089/nsd_springbootserver/userinfo/addorupdateuser",
					data:{
						username:"哈哈哈哈",
						userpwd:"1234",
						useraddress:"青岛",
						usertel:"123456"
					},
					method:"POST",
					success(res) {
						console.log(res)
					}
				})
			},
			sendImg(){
				uni.chooseImage({
					count:9,
					success:res=>{
						this.imgarr=res.tempFilePaths
						console.log(this.imgarr)
					}
				})
			},
			previewImg(current){
				uni.previewImage({
					current:current,
					urls:this.imgarr
				})
			}

		}
	}
</script>

<style>
	/* @import url("../../static/food/iconfont.css"); */

	@import url("../../static/fonts/iconfont.css");
	/* @import url("../../static/uni_style.css"); */
	.box{
		width: 375rpx;
		height: 375rpx;
		background-color: #DD524D;
	}

</style>
